package com.joysuch.wwyt.bp.controller;

import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.risk.bean.BatchDrawingSearchBean;
import com.joysuch.wwyt.risk.bean.UpdateLocationBean;
import com.joysuch.wwyt.bp.service.BatchDrawingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author zero
 * @since 2022/1/4 10:01
 * 批量绘制
 */
@RestController
@RequestMapping("/bp/batchDrawing")
@Api(tags = "批量绘制")
public class BatchDrawingController {

    @Autowired
    private BatchDrawingService batchDrawingService;
    
    @GetMapping("/fenceAndPoint")
    @ApiOperation("批量画围栏和点位查询")
    public ResultBean fenceAndPoint(BatchDrawingSearchBean bean){
        return batchDrawingService.drawFenceAndPoint(bean);
    }
    
    
    @PostMapping("/updateLocation")
    @ApiOperation("根据类型更新位置")
    public ResultBean updateLocation(@RequestBody UpdateLocationBean bean){
        batchDrawingService.updateLocation(bean);
        return ResultBean.defaultSuccessResult();
    }
    
    @GetMapping("/getQuantity")
    @ApiOperation("根据类型查询数据总数以及拥有位置的数量")
    public ResultBean getQuantity(Integer type){
        List<Map<String, Long>> quantity = batchDrawingService.getQuantity(type);
        return ResultBean.success(quantity);
    }


    @GetMapping("/getAllFenceOrPoint")
    @ApiOperation("根据类型查询所有有点位的数据")
    public ResultBean getAllFenceOrPoint(Integer type){
        return batchDrawingService.getAllFenceOrPoint(type);
    }
    
}
